<template>
  <div class="message-container">

    <div style="margin-left:20px;margin-right:20px;height: 100px" @click="Suk_tonewdis">
      <img :src="imgurl" style="width: 100%;height: 100%">
    </div>
    <div v-if="show == 1" class="nom">
      <img src="@/assets/img/none.png" class="noimg">
    </div>
    <div
      v-for="(item,index)  in items"
      :key="index"
      class="list boxjiushi">
      <!--      @click="todetail(index)"-->
      <!--    >-->
      <p>{{ item.title }}</p>
      <i>{{ item.time }}</i>
      <div class="content">
        <img :src="item.image">
        <span class="desc">{{ item.content }}</span>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      items: [],
      show: 0,
      imgurl: ""
    };
  },
  created() {
    this.getlist();
  },
  methods: {

    Suk_tonewdis() {
      let that = this
      that.$router.push({
        name: 'newdis'
      })
    },
    todetail(index) {
      let that = this;
      that.$router.push({
        name: "messagedetail",
        params: {
          index: index
        }
      });
    },
    getlist() {
      let that = this;
      that.$toast.loading({
        message: "加载中..."
      });
      console.log(123);
      var Sukdata = {};
      console.log(Sukdata);
      that.axios
        .post(that.baseUrl + "/notice/querySystem", that.Qs.stringify(Sukdata), {
          headers: {
            "Content-Type": "application/x-www-form-urlencoded"
          }
        })
        .then(function (res) {
          if (res.request.status === 200) {
            console.log(res.data);
            if (res.data.meta.code == 200) {
              that.items = res.data.data;
              if (res.data.data.length <= 0) {
                that.show = 1;
              }
              that.$toast.clear();
            } else if (res.data.meta.code == 501) {
            }
          }
        });
      var Sukdata2 = {id: 1};
      that.axios
        .post(that.baseUrl + "/tt/queryOne", {
          headers: {
            "Content-Type": "application/x-www-form-urlencoded"
          }
        })
        .then(function (res) {
          if (res.request.status === 200) {
            that.imgurl = res.data.data.img;
            that.$toast.clear();
          }
        });
    }
  }
};
</script>
<style lang="scss" scoped>
.nom {
  text-align: center;
  margin-top: 45%;
  font-size: 25px;
}

body {
  background: #f4f4f4;
}

.noimg {
  width: 100%;
}

.message-container {
  font-size: 0.3rem;
  background: #f4f4f4;
  padding-top: 0.3rem;
}

.boxjiushi {
  width: 90%;
  margin: 0 auto;
}

.list {
  margin-top: 15px;
  min-height: 100px;
  /*margin-bottom: 3rem;*/
  padding: 15px;
  background: #fff;
  border-radius: 5px;
}

.list {
  p {
    font-size: 15px;
    font-weight: 900;
  }

  i {
    font-style: normal;
    display: inline-block;
    width: 100%;
    text-align: right;
    color: #a0a0a0;
  }

  .desc {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
    overflow: hidden;
  }
}

.content {
  display: inline-block;
  height: 100%;
}

.content img {
  width: 120px;
  height: 60px;
  float: left;
  margin-right: 5px;
}
</style>

